Skip to content

[AlertZero] Action catalog - #290705

Merged
patrykkopycinski merged 15 commits into
mainfrom
alertzero/action-catalog
Sep 15, 2026
Merged

patrykkopycinski merged 15 commits into
mainfrom
alertzero/action-catalog

Conversation

@patrykkopycinski

Copy link
Copy Markdown
Contributor

Summary

Implements the AlertZero action catalog (security-team#19288): category-scoped discovery of installed action workflows, exposed both as an internal HTTP API and as an Agent Builder builtin tool so workers can discover actions at runtime instead of hard-coding workflow ids.

Builds on #289683 (action proposals common layer).

API

  • GET /internal/alertzero/actions?categories=contain,escalate in the alertzero plugin
  • Tag-driven discovery: workflows tagged action with consts.actionMetadata are projected to lightweight catalog entries (workflowId, name, description, category, impact, approvalPolicy)
  • categories is an OR-set: repeated param (?categories=a&categories=b) or comma-joined (?categories=a,b), at most 20 values, >20 → 400
  • Category vocabulary is solution-owned (alertzero, nightshift, …) — no enum validation; unknown categories match nothing
  • alertzero_read privilege required

Agent Builder tool

  • security.alertzero.actions.list_by_category — builtin, read-only, registered from the alertzero plugin setup() following the Cases-plugin pattern
  • Handler calls ActionsService in-process (same service as the API) so the tool and API can never drift
  • Allow-listed in AGENT_BUILDER_BUILTIN_TOOLS

Worker wiring

  • floor_alert_triage managed workflow grants the tool via configuration_overrides.tools; managed version 1 → 2 with the fingerprint guard test updated

Design notes

  • Query passes managedFilter: 'managed' — action workflows are managed installs in the global space; the search service's unmanaged default would filter them all out (caught live in e2e; guarded by a dedicated test)
  • Invalid consts.actionMetadata on one workflow is skipped with a warning, never fails the catalog
  • The service pages through results (size 100) until all tagged workflows are read

Testing

  • Unit: actions_service (9 incl. managed-filter + paging guards), list_actions route (4), read_categories_query_param (8), list_actions_by_category_tool (4), plugin registration mock — alertzero 219/219
  • kbn-workflows 2036/2036 (incl. updated fingerprint guard), kbn-alertzero-common 17/17
  • tsc 0 errors, ESLint clean
  • E2E on a dedicated dev stack (own ES + Kibana, security on): API returns the installed Create detection rule action with category tune; filtering verified single/repeated/comma; unknown category → empty not error; 403 without privilege; tool visible in the live Agent Builder registry

…coped discovery

Implements elastic/security-team#19288.

- GET /internal/alertzero/actions — lists installed action workflows
  (tag: action) with optional categories filter; category is a
  solution-owned keyword, never validated against an enum
- ActionsService: tag-driven discovery, consts.actionMetadata projection,
  skips invalid metadata with a warning
- security.alertzero.actions.listByCategory builtin Agent Builder tool
  wrapping the same service (tool and API cannot drift)
- floor_alert_triage worker: configuration_overrides.tools wiring +
  managed version bump (fingerprint guard updated)

Unit-tested at every layer: service, route param parsing, route handler,
tool handler.
…l-id doc comment

- readActionCategoriesQueryParam now throws InvalidCategoriesError; the route maps it to 400 badRequest with the param message instead of a generic 500
- doc comment on list_actions_by_category_tool referenced the pre-rename camelCase id; corrected to list_by_category
- adds route test for the 400 path
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

1 similar comment
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

1 similar comment
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

# Conflicts:
#	x-pack/solutions/security/plugins/alertzero/moon.yml
#	x-pack/solutions/security/plugins/alertzero/tsconfig.json
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

1 similar comment
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@patrykkopycinski
patrykkopycinski marked this pull request as ready for review September 14, 2026 20:21
@patrykkopycinski
patrykkopycinski requested review from a team as code owners September 14, 2026 20:21
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the action catalog change. One concrete issue: the floor_alert_triage definition.version (3) is out of sync with the fingerprint guard test's expected prefix (2:faf316b1), which will fail the managed_workflow_definitions guard. Details inline.

Generated by Claude Reviewer for #290705 · claude · opus · 131.8 AIC · ⌖ 27.3 AIC · ⊞ 5.5K

management: ALERTZERO_WORKER_MANAGEMENT,
pluginId: ALERTZERO_MANAGED_WORKFLOW_PLUGIN_ID,
version: 1,
version: 3,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version is bumped to 3, but the fingerprint guard in managed_workflow_definitions.test.ts expects 2:faf316b1. That test builds `${definition.version}:${createContentFingerprint(importedYaml)}`, so it will compute 3:faf316b1 and fail (expected 2:faf316b1). The version was 1 on main and the YAML changed once here, so this should be 2 to match the guard (the PR description also says "managed version 1 → 2"). If 3 is intentional, the expected fingerprint must be updated to 3:faf316b1 instead.

Suggested change
version: 3,
version: 2,

@botelastic botelastic Bot added the Team:One Workflow Team label for One Workflow (Workflow automation) label Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

⏳ Building and deploying preview... View progress

This comment will be updated with preview links when the build is complete.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Elastic Docs Style Checker (Vale)

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.

@patrykkopycinski patrykkopycinski added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Sep 14, 2026
@patrykkopycinski

Copy link
Copy Markdown
Contributor Author

/ci

@kibanamachine

Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

Test Failures

  • [job] [logs] Jest Tests #8 / should render the content
  • [job] [logs] FTR Configs #45 / alerting api integration security and spaces enabled - Group 4 Alerts alerts alerts space_1_all_with_restricted_fixture at space1 should not throttle when changing groups
  • [job] [logs] FTR Configs #132 / discover discover field visualize button "before all" hook for "shows "visualize" field button"
  • [job] [logs] Scout Lane #23 - stateful-classic / default / local-stateful-classic - getCertificates - returns an empty result when no monitors are configured
  • [job] [logs] Jest Tests #9 / MCP ConnectorFields should render server URL field
  • [job] [logs] Jest Tests #3 / Status should render active execution status message

History

@semd semd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting buildkite-ci release_note:skip Skip the PR/issue when compiling release notes Team:One Workflow Team label for One Workflow (Workflow automation) v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants